package com.example.designpatterns.behavioral.chain;

/**
 * 具体处理者：检查用户角色信息
 *
 * @author scott
 */
public class RoleCheckMiddleware extends Middleware {

    private final static String ADMIN = "admin@example.com";

    @Override
    public boolean check(String email, String password) {
        if (email.equals(ADMIN)) {
            System.out.println("欢迎登录，管理员。");
        } else {
            System.out.println("欢迎登录，用户。");
        }
        return checkNext(email, password);
    }

}
